# -*-coding:utf-8 -*-
import os

from env import Env

BASE_DIR = os.getcwd()

BASE_LOG_DIR = "/data/log/crawler-spider/"
if not os.path.exists(BASE_LOG_DIR):
    os.makedirs(BASE_LOG_DIR)

hostname = os.popen('hostname').read().split('-')[-2]

if 'online' in hostname:
    ACTIVE = "online"
else:
    ACTIVE = 'dev'

ENV = Env.get_env(ACTIVE)

PROXY_ADDRESS = ENV.PROXY_ADDRESS

MESSAGE_SERVER_ADDRESS = ENV.MESSAGE_SERVER_ADDRESS

MONITOR_ADDRESS = ENV.MONITOR_ADDRESS
MONGO_ADDRESS = ENV.MONGO_ADDRESS
MONGO_DATABASE = ENV.MONGO_DATABASE
MONGO_LOG = ENV.MONGO_LOG

SPIDER_CONFIG_API = ENV.SPIDER_CONFIG_API
HEARTBEAT_API = ENV.HEARTBEAT_API
SPIDER_SUMMARY_API = ENV.SPIDER_SUMMARY_API

OCR_SERVER_ADDRESS = ENV.OCR_SERVER_ADDRESS

CALLBACK_ADDRESS = ENV.CALLBACK_ADDRESS
CALLBACK_API = ENV.CALLBACK_API

REDIS_HOST = ENV.REDIS_HOST
REDIS_AUTH = ENV.REDIS_AUTH
REDIS_PORT = ENV.REDIS_PORT


